//
//  ExceptionManager.m
//  PushInappTestiOS
//
//  Created by KyuJin on 13. 1. 13..
//
//

#import "ExceptionManager.h"

@implementation ExceptionManager

+ (void) raiseExceptionWith:(EXCEPTION_TYPE)exceptionType
{
    NSString *errorMesseage = nil;
    NSString *errorCode = nil;
    
    switch (exceptionType) {
        case EXCEPTION_TYPE_NETWORK:
            errorMesseage = @"Network connection error.\nPlease check your network state.";
            errorCode = ERROR_CODE_NETWORK;
            break;
            
        case EXCEPTION_TYPE_TIMEOUT:
            errorMesseage = @"Timeout error.\nPlease check your network state.";
            errorCode = ERROR_CODE_TIMEOUT;
            break;
            
        case EXCEPTION_TYPE_TOKEN:
            errorMesseage = @"Device Token Error.\nPlease check your push service state.";
            errorCode = ERROR_CODE_TOKEN;
            break;
            
        default:
            errorMesseage = @"Unknown error.\nPlease contact developer.";
            errorCode = ERROR_CODE_UNKNOWN;
            break;
    }
    
    [NSException raise:errorCode format:errorMesseage];
}
@end
